<?php if (!defined('THINK_PATH')) exit();?><html>
<head>
<title>商品管理</title>
    <script src="/drclothes/Public/js/jquery.min.js"></script>
<script src="/drclothes/Public/js/bootstrap.min.js"></script>
<link href="/drclothes/Public/css/bootstrap.min.css" rel="stylesheet">
<link href="/drclothes/Public/css/admin.css" rel="stylesheet">
<script>
    $(document).ready(function () {
    //高亮当前选中的导航
    var myNav = $(".nav-sidebar > li > a");
    for (var i = 0; i < myNav.length; i++) {
        var links = myNav.eq(i).attr("href");
        var myURL = document.URL;
        var durl=/http:\/\/([^\/]+)\//i;
        domain = myURL.match(durl);
        console.log(myURL.match(durl));
        var result = myURL.replace("http://"+domain[1],"");
        if (links == result) {
            myNav.eq(i).parents("li").addClass("active");
        }
    }
});
</script>
</head>

<body>
    <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container" style="background-color:#095dd1;">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false"
                    aria-controls="navbar">
            <span class="sr-only">Drclothes后台管理系统</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
                <a class="navbar-brand" href="#">Drclothes后台管理系统</a>
            </div>
            <div id="navbar" class="navbar-collapse collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li><a style="background-color:rgba(1,1,1,0.5);top:0px;" class="glyphicon glyphicon-user"> <?php echo I('session.usernameA'); ?></a></li>
                    <li><a href="/drclothes/index.php/admin/form/logout"  style="background-color:rgba(1,1,1,0.5);">退出</a></li>
                </ul>
            </div>
        </div>
    </nav>
    <div class="container">
        <div class="row">
            <div class="col-xs-2 padding1" style="background-color:rgba(255,255,255,0.5);padding-top:0px;min-height:100%;">
                <ul class="nav nav-sidebar">
                    <li><a href="/drclothes/index.php/admin/Order" class="glyphicon glyphicon-tags"> 订单管理</a></li>
                    <li><a href="/drclothes/index.php/admin/drclothes" class="glyphicon glyphicon-inbox"> 商品管理</a></li>
                    <li><a href="/drclothes/index.php/admin/User" class="glyphicon glyphicon-user"> 用户列表</a></li>
                    <li><a href="/drclothes/index.php/admin/News" class="glyphicon glyphicon-edit"> 公告列表</a></li>
                    <li><a href="/drclothes/index.php/admin/Comment" class="glyphicon glyphicon-comment"> 评论管理</a></li>
                </ul>
            </div>
            <div class="col-xs-10 main">
          <p class="pull-right" style="margin-top: 20px;"><a class="btn btn-info" href="/drclothes/index.php/Admin/drclothes/add">添加</a> <button class="btn btn-info" type="button" id="deleteA">批量删除</button></p>
          <h2 class="sub-header">商品管理</h2>
          <div class="table-responsive">
            <table class="table table-striped table-hover">
              <thead>
                <tr  style="word-break:keep-all;">
                  <th><input class="all" type="checkbox"/></th>
                  <th>编号</th>
                  <th>商品名</th>
                  <th>描述</th>
                  <th>价格</th>
                  <th>图片</th>
                  <th>管理</th>
                </tr>
              </thead>
              <tbody>
                <form action="/drclothes/index.php/admin/drclothes/delete_all" method="get" id="list">
                <?php if(is_array($list)): $k = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "$empty" ;else: foreach($__LIST__ as $key=>$item): $mod = ($k % 2 );++$k;?><tr>
                  <td><input name='id[]' type='checkbox' value='<?php echo ($item["id"]); ?>' class="noborder"></td>
                  <td><?php echo ($k); ?></td>
                  <td><?php echo ($item["name"]); ?></td>
                  <td><?php echo ($item["description"]); ?></td>
                  <td><?php echo ($item["price"]); ?></td>
                  <td><img class="img-rounded" style="height:20%;width:auto;" src="/drclothes/Public/<?php echo ($item["img"]); ?>"/></td>
                  <td><a class="btn btn-info" href="/drclothes/index.php/Admin/drclothes/change?id=<?php echo ($item["id"]); ?>" style="margin-top:5px;">修改</a><a class="btn btn-info" href="/drclothes/index.php/Admin/drclothes/delete?id=<?php echo ($item["id"]); ?>" style="margin-top:5px;">删除</a></td>
                </tr><?php endforeach; endif; else: echo "$empty" ;endif; ?>
                </form>
              </tbody>
            </table>

          </div>
        <div class="pages">
            <?php echo ($page); ?>
        </div>
        </div>
      </div>
    </div>
  <script type="text/javascript">
    $('.all').click(function() {
      if($(this).is(':checked')) {
        $(':checkbox').attr('checked', 'checked');
      } else {
        $(':checkbox').removeAttr('checked');
      }
    });
    $('#deleteA').click(function() {
    if($(':checked').size() > 0) {
      $("#list").submit();
    } else {
      alert('没有选择！');
    }
  });

  </script>
</body>
</html>